﻿if exists (select * from sysobjects where id = object_id(N'pBUGLOGBugsSummaryAdd') and sysstat & 0xf = 4) drop procedure pBUGLOGBugsSummaryAdd 
GO

-- Creates a new record in the [dbo].[BugsSummary] table.
CREATE PROCEDURE pBUGLOGBugsSummaryAdd
    @p_BugShortDescription varchar(50),
    @p_Date smalldatetime,
    @p_userID int,
    @p_PriorityID int,
    @p_StatusID int,
    @p_Assigned int,
    @p_FixedBy int,
    @p_Description nvarchar(450),
    @p_EnvBUGLOGment nvarchar(450),
    @p_StepsToReproduce nvarchar(450),
    @p_Note ntext,
    @p_ImageAttachment image,
    @p_TaskID int,
    @p_TestCaseID int,
    @p_BugId_out int output
AS
BEGIN
    INSERT
    INTO [dbo].[BugsSummary]
        (
            [BugShortDescription],
            [Date],
            [userID],
            [PriorityID],
            [StatusID],
            [Assigned],
            [FixedBy],
            [Description],
            [EnvBUGLOGment],
            [StepsToReproduce],
            [Note],
            [ImageAttachment],
            [TaskID],
            [TestCaseID]
        )
    VALUES
        (
             @p_BugShortDescription,
             @p_Date,
             @p_userID,
             @p_PriorityID,
             @p_StatusID,
             @p_Assigned,
             @p_FixedBy,
             @p_Description,
             @p_EnvBUGLOGment,
             @p_StepsToReproduce,
             @p_Note,
             @p_ImageAttachment,
             @p_TaskID,
             @p_TestCaseID
        )

    SET @p_BugId_out = SCOPE_IDENTITY()

END

